<?php

class galleryBlockWidgetComponents extends myComponents{
	
	public function executeRender(){
		$this->banners = $this->getBanners();

//		print_r($this->banners->toArray());
//		exit;
	}

	protected function getBanners(){

		$result = new Doctrine_Collection('Banner');

		$q = Doctrine::getTable('Banner')->createQuery('b')
			->select('b.*')
			->from('Banner b')
			->innerJoin('b.BannerGroup bg')
			->innerJoin('bg.StructureBannerGroups sbg')
			->innerJoin('sbg.Structure s WITH s.id = ?', $this->getRoute()->getObject()->getId())
			->where('bg.type = ?', 'logos')
			->orderBy('b.pri desc')
			->limit(2);

		$result = $result->merge($q->execute());


		return $result;
	}


}
